package cn.bonoon.controllers.faq;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.bonoon.core.plugins.FaqService;
import cn.bonoon.entities.plugins.FaqEntity;
import cn.bonoon.kernel.web.annotations.grid.GridStandardDefinition;
import cn.bonoon.kernel.web.controllers.AbstractGridController;

@Controller
@RequestMapping("/s/sys/faq")
public class FAQController extends AbstractGridController<FaqEntity, FAQItem> {
	private final FaqService service;

	@Autowired
	public FAQController(FaqService service) {
		super(service);
		this.service = service;
	}

	@Override
	protected Class<FAQItem> itemClass() {
		return FAQItem.class;
	}

	@Override
	@GridStandardDefinition(
			insertClass = FAQEditor.class, 
			updateClass = FAQEditor.class, 
			detailClass = FAQDetail.class)
	protected FaqService initLayoutGrid(LayoutGridRegister register) throws Exception {
		//register.setDefaultDialogWidth(740);
		// 添加按键
//		DialogInsertHandler.toolbar(register, service, FAQEditor.class);
//		OperateIdsHandler.delete(register, service);
//
//		DialogDetailHandler.button(register, service, FAQDetail.class);
//		DialogUpdateHandler.button(register, service, FAQEditor.class);
//		OperateIdHandler.delete(register, service);
		return service;
	}
}
